import {objectAppend} from './utils';
/**
 * 每个容器组件对应一个reducer
 * 这里可以唯一知道新旧状态的地方
 */
const defaultState={
    text:'测试文本',
    homeData:{},
    aboutData:{}
};

export default (state, action) => {
    let newState={};
    switch (action.type){
        case 'HOME_DATA':
            newState.homeData=action.data;
            break;
        case 'ABOUT_DATA':
            newState.aboutData=action.data;
            break;
        default:return state||defaultState;
    }
    return objectAppend(newState, state);
}